from math import sqrt
n = int(input())
he = 0
for i in range(2, n + 1):
    k = int(sqrt(i))
    flag = 1
    for j in range(2, k + 1):
        if i % j == 0:
            flag = 0
            break
    if flag:
        print(i, end=" ")
        he = he+i

print('素数之和=',he)
